Skip to content

fix(proxy): use local SPDK client for engine lookup in v2 VolumeGet#1430

Open
derekbit wants to merge 1 commit into
longhorn:masterfrom
derekbit:issue-13215
Open

fix(proxy): use local SPDK client for engine lookup in v2 VolumeGet#1430
derekbit wants to merge 1 commit into
longhorn:masterfrom
derekbit:issue-13215

Conversation

@derekbit
Copy link
Copy Markdown
Member

Which issue(s) this PR fixes:

Issue longhorn/longhorn#13215

What this PR does / why we need it:

The v2 proxy VolumeGet handler previously used req.Address (the DirectToURL of the service object) to create an SPDK client for both engine and EngineFrontend lookups. For v2 volumes, the manager passes the EngineFrontend's IM address as req.Address so the proxy can observe the frontend device state.

When engine and EngineFrontend are on different Instance Managers (e.g. after fault recovery), this causes the handler to look up the engine on the EF's IM where it does not exist, resulting in a permanent NotFound error.

Fix this by separating the two lookups:

  • Engine: always use the local SPDK service (the proxy runs on the engine's IM, so the engine is guaranteed to be local)
  • EngineFrontend: use req.Address to reach the potentially remote EF IM

If the EF client connection fails, gracefully degrade to engine-only info rather than failing the entire call.

Special notes for your reviewer:

Additional documentation or context

@derekbit
Copy link
Copy Markdown
Member Author

Hello @davidcheng0922 Could you help review it? Thank you.

@derekbit
Copy link
Copy Markdown
Member Author

@mergify backport v1.12.x

@mergify
Copy link
Copy Markdown

mergify Bot commented May 27, 2026

backport v1.12.x

🟠 Waiting for conditions to match

Details
  • merged [📌 backport requirement]

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes v2 proxy VolumeGet failures when the Engine and EngineFrontend are hosted on different Instance Managers (e.g., after fault recovery) by using the local SPDK service for engine lookup while using req.Address only for EngineFrontend lookup.

Changes:

  • Updated v2 VolumeGet to always use the local SPDK service for EngineGet, independent of req.Address.
  • Added a separate SPDK client path for EngineFrontendGet that targets req.Address, with graceful fallback to engine-only info when the EF client cannot be created.
  • Extended V2DataEngineProxyOps to carry spdkServiceAddress from NewProxy.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/proxy/volume.go Splits v2 VolumeGet lookups into local engine vs. (possibly remote) EngineFrontend, with fallback behavior.
pkg/proxy/proxy.go Adds spdkServiceAddress to V2DataEngineProxyOps and wires it from NewProxy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/proxy/volume.go
Comment thread pkg/proxy/volume.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

Comment thread pkg/proxy/volume.go Outdated
Comment thread pkg/proxy/volume.go
Comment thread pkg/proxy/volume.go
Comment thread pkg/proxy/volume.go
Comment thread pkg/proxy/volume.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread pkg/proxy/volume.go
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread pkg/proxy/volume.go Outdated
Comment thread pkg/proxy/volume.go
@derekbit derekbit force-pushed the issue-13215 branch 2 times, most recently from 53489e0 to 68bdbaa Compare May 27, 2026 15:26
@derekbit derekbit requested a review from Copilot May 27, 2026 15:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread pkg/proxy/volume.go
Comment thread pkg/proxy/volume.go
Comment thread pkg/proxy/proxy.go
The v2 proxy VolumeGet handler previously used req.Address (the
DirectToURL of the service object) to create an SPDK client for both
engine and EngineFrontend lookups. For v2 volumes, the manager passes
the EngineFrontend's IM address as req.Address so the proxy can observe
the frontend device state.

When engine and EngineFrontend are on different Instance Managers (e.g.
after fault recovery), this causes the handler to look up the engine on
the EF's IM where it does not exist, resulting in a permanent NotFound
error.

Fix this by separating the two lookups:
- Engine: always use the local SPDK service (the proxy runs on the
  engine's IM, so the engine is guaranteed to be local)
- EngineFrontend: use req.Address to reach the potentially remote EF IM

If the EF client connection fails, gracefully degrade to engine-only
info rather than failing the entire call.

Longhorn 13215

Signed-off-by: Derek Su <derek.su@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants